package com.sc.nft.dao;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.sc.nft.dto.UserPerformanceDTO;
import lombok.extern.slf4j.Slf4j;
import com.sc.nft.entity.UserPerformance;
import com.sc.nft.mapper.UserPerformanceMapper;
import  com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Repository;

import java.math.BigDecimal;
import java.util.List;

/**
 * 用户业绩表(sc_user_performance)数据DAO
 *
 * @author zxy
 * @since 2023-07-20 17:29:27
 * @description 用户市值
 */
@Slf4j
@Repository
public class UserPerformanceDao extends ServiceImpl<UserPerformanceMapper, UserPerformance> {

    public UserPerformance getByUserIdAndDate(Long userId,String date){
        LambdaQueryWrapper<UserPerformance> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(UserPerformance::getUserId,userId);
        wrapper.eq(UserPerformance::getRecordDate,date);
        return getOne(wrapper);
    }



    public BigDecimal getSumTermPerformance(Long userId,String start ){
        return baseMapper.getSumTermPerformance(userId,start);
    }
    public BigDecimal getCenterSumTermPerformance(Long userId,String start ){
        return baseMapper.getCenterSumTermPerformance(userId,start);
    }


}